www.webdeveloper.com
Results 1 to 2 of 2

Thread: single or double quote problem!

  1. #1
    Join Date
    Nov 2013
    Posts
    44

    single or double quote problem!

    single and double quote is bugging me.I've been trying to set id automatically to an element.But i don't know what should be the right form.say like....
    Code:
    var m=["img1.jpg","img2.jpg","img3.jpg"]
    for(i=0;i<5;i++){
    <img src="'+m[i]+'" id="+i+"
    is it ok?i mean can i do this stuff?where can i learn about the correct use of single and double quote?
    it also troubles me passing arguments to function.
    please help!!!!

  2. #2
    Join Date
    Sep 2008
    Location
    Akron, OH
    Posts
    1,105
    Not sure what you're trying to do here. The script is incomplete.

    Code:
    <script type="text/javascript">
    	var m = ["img1.jpg","img2.jpg","img3.jpg"]
    	for (i=0; i<5; i++) {
    		document.write('<img src="' + m[i] + '" id="' + i + '">Link Text</a>');
    	}
    </script>
    I'm always up for networking with fellow web professionals. Connect with me on LinkedIn if you like!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles