Help With Javascript Coding

Discussion in 'Gaming' started by mev1205, Jul 2, 2006.

  1. mev1205

    mev1205 Well-Known Member

    Posts:
    213
    Likes Received:
    0
    Joined:
    Feb 20, 2005
    Location:
    Texas
    Alright, so I've been trying to do this for awhile, and nothing seems to work...

    I want a code where I can click on an image, and it will bring up a new pop-up window with another website. I want a pop-up window, not a browser window.

    I was trying to use this:
    Code:
    <form>
    <input name="image" name="image" src="images/index_23.gif" value="New Window!" onClick="window.open('[url]http://google.com,'mywindow','width=800,height=500'[/url])">
    </form>
    And it was working, except it wouldn't display my image at all... can anybody help?
     
  2. A89

    A89 Well-Known Member

    Posts:
    793
    Likes Received:
    0
    Joined:
    Apr 26, 2006
    Your trying to host it on a website? :unsure:

    I'm unsure of what your trying to say...
     
  3. Equivalent Exchange

    Equivalent Exchange Well-Known Member

    Posts:
    1,466
    Likes Received:
    0
    Joined:
    Nov 9, 2005
    change src="images/index_23.gif" to style="background:no-repeat url(images/index_23.gif);wdith:W*;height:H*"

    W* = Width of picture
    H* = Height of picture

    also, add the attribute value="" to it, otherwise the text "New Window!" is going to appear over your picture, unless thats what you want.

    You cant display images using input and src
     
  4. mev1205

    mev1205 Well-Known Member

    Posts:
    213
    Likes Received:
    0
    Joined:
    Feb 20, 2005
    Location:
    Texas
    Tried that, but still no luck...

    I uploaded to see if it would help any for you to look at the source code:

    http://raidclan.bizhat.com/test2.htm
     
  5. Equivalent Exchange

    Equivalent Exchange Well-Known Member

    Posts:
    1,466
    Likes Received:
    0
    Joined:
    Nov 9, 2005
    You did differently than what I said ;)

    Code:
    <input name="image" style="background:no-repeat url(images/index_23.gif) width="289 height="41" value="" onClick="window.open('[url]http://raidclan.bizhat.com/main.htm','mywindow','width=800,height=500'[/url])">

    Should be

    Code:
    <input name="image" style="background:no-repeat url(images/index_23.gif);width:289px;height:41px" value="" type="submit" onClick="window.open('[url]http://raidclan.bizhat.com/main.htm','mywindow','width=800,height=500'[/url])">
    Also, I added type="submit" becuase using as a text field just wouldnt make sense...

    And really, I dont get what the point of using a form to do this is... You could simply make an image with <img> and give it the onClick attribute...
     
  6. mev1205

    mev1205 Well-Known Member

    Posts:
    213
    Likes Received:
    0
    Joined:
    Feb 20, 2005
    Location:
    Texas
    You can? Damn, I didn't know that, I thought you had to use this method... oh well, it finally works now, thanks for the help :D
     
  7. Equivalent Exchange

    Equivalent Exchange Well-Known Member

    Posts:
    1,466
    Likes Received:
    0
    Joined:
    Nov 9, 2005
    You can apply the onclick to almost anything, <img>, <a>,

    , you name it.
     

Share This Page