#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    North West UK
    Posts
    119
    Rep Power
    13

    inserting javascript into html document


    I can insert javascript into a html document - so long as it doesn't already have a head section full of javascript. I get confused as to whether I need to encapsulate my javascript with more <scipt></script> type of tags.
    I have two htnl pages, that work well together. The html page called poplink2.html opens a popup page in the center of the screen containing a page called sticky.html.
    When I try to insert the script bit of poplink2.html into a web page that I've made with Dreamweaver (http://p0c79.phpwebhosting.com/home.html) dreamweaver bleeps at me when I insert the head bit and it doesn't work. There is no popup when you click the link - it behaves like an ordinary link and the page just loads in the main browser window.
    I would like to show you poplink2.html and the page that loads in the popup, called sticky.html - this forum seems to only allow one file in the attachment and it will not allow .html extension, therefore I have changed poplink2.html to poplink2.jsp and will post again with sticky.html as sticky.jsp
    How do I get poplink2.html into my web pages?
    thanks
    david
    Attached Files
    Last edited by davidgraham16; January 22nd, 2003 at 03:43 PM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    North West UK
    Posts
    119
    Rep Power
    13

    the other file - sticky.jsp


    Please help!
    regards
    david
    Attached Files
  4. #3
  5. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    hi david....

    Take another shot at explaining this if you can...someone will clear it up for you (might want to post to a DW board as well).

    adios []
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    North West UK
    Posts
    119
    Rep Power
    13

    re-inserting javascript


    Hi Adios
    I had a difficult task to describe my problem but the problem itself is something that is quite simple and is due to the fact that I know very little javascript.
    Basically, I can't be using the correct convention when I insert multiple javascripts into the same html document - the way I do it (manually in code view in DW) does not work, the different scripts interfere with each other - they work correctly if the is only one javascript in the page.
    Do you open and close <script> </script> tags in the head for each new script? tried all sort of combinations, no luck so far? I think you could spot what I'm doing wrong if you look at the web page http://p0c79.phpwebhosting.com/home.html that I'm trying to insert the script that opens a popup i.e. poplink2.html into.
    thanks
    david
    I will try the DW group as you suggested.
  8. #5
  9. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    Pretty nicely explained here. No, you don't need a separate <script></script> 'container' for each JS, although it doesn't hurt anything; some developers do it that way for neatness' sake. If your scripts are clashing, it's generally because 1) they assign code to the window's onload event handler, which needs to be done in one go; or 2) they use variables with the same name which over-write one another.

    Looked at the url you posted - but I can't see anything except that (mind-numbing) MacroMedia MishMash that's specifically designed to be impenetrable. No sign of 'poplink2' anywhere!

  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    North West UK
    Posts
    119
    Rep Power
    13

    poplink2.html


    Hi
    Thanks adios for the link.
    I don't have poplink2.html in the web page anymore as it doesn't work. Sorry, if I have confused you. I will put it back in the web page (you should see a link under the sqaure graphic) in about 10 minuites after replying to your post.
    Thanks for trying to help me
    david
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    North West UK
    Posts
    119
    Rep Power
    13

    a brainwave?


    Hi
    Just thought how it might be easier. I have seen examples of scripts that are not embedded in the page, instead there is a reference to the script in the the script tag, something like src="blah.js
    Do you know what I'm referring to
    Must get poplink2.html back into the home page - do that now
    thanks again
    david
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    North West UK
    Posts
    119
    Rep Power
    13

    solved problem


    Hi
    The problem was DW was not saving the function in the head, I don't know why not. When I added the function to the web page outside of DW everything is OK
    thanks to adios for helping
    david

IMN logo majestic logo threadwatch logo seochat tools logo