Jump to content

Webworldx

Members
  • Posts

    347
  • Joined

  • Last visited

Posts posted by Webworldx

  1. [sorry for getting off the point of the thread, although I think it's been solved,really]Heh, I read the article and I must say I think even the guys in it are confused! The "for and against" at the end aren't really that conclusive, and i'd lean more towards the "for" side. It's much much faster in parsing in browsers, which I think is the main downer for promoting DOM over it. Why would you want to implement something that runs slower than what you've currently got? I think it's a bit unfair they compare it to "goto" too. I've been using VB for years now, and goto is my pet hate, and an absolute last resort in anything i've ever created!:) I like innerHTML.. what i don't like is people who try and use it as an absolute string.. like:document.body.innerHTML = document.body.innerHTML.replace(...and expect it to work effectively. I can see their reservations on teaching it to newbies, but it's such a powerful tool, I think it'd be wrong to dismiss it :)

  2. What's wrong with <a id='mg'>School</a>document.getElementById('mg').innerHTML??Edit: I can see Raimo's point above with multiple nodes underneath, and not wanting to use innerHTML.. but it's not bad if there's only going to be a text node in there.

  3. Heh.. now that is stupid. Would it be possible to check server side with the ExecPHP thing to see if a user had modified the data (for instance, check the format the data came in). I suppose that could limit damage?

  4. Eep. I wouldn't go rewriting the innerHTML of the body, or appending to it after load.aspnetguy, i've also noticed the rewrite thing, but that's often after the page has loaded and the document has close()'d itself, writing to it would cause a new page to be created.DOM methods are the nicest way, appending to the body or removing that way :)

  5. and it works only with MSIE : so it can't be used seriously in real world
    I think that's the important bit, really. It's an IE only JScript extension, so you should be looking to use alternative methods (although I know there aren't for some of the more specific execCommands() options.)
  6. it's this line:if ((x=="main.html")||(x=="wishlist.html")||(x=="prodblank.html")||(x=="form.html")||(x=="product1.htm")||(x=="index.html")){ The referrer always returns the FULL url, but you're only equating to a little bit of it.Try:if(x.match(/(main|wishlist|prodblank|form|product1|index).htm/i) != null){

  7. I like the remove by index or text, that's quite a cool idea, but most of the other things just seem to be replacing one name for another (e.g. Items.Count and Items.length). I'd like to see the XHTML/CSS version though, have you seen: http://www.easy-designs.net/...replace.../final.html. I think that's a very nice CSS/JS way of creating a box, and you can use keyboard keys if you tab to it too :) Adding and removing items to that shouldn't be too difficult a job

  8. Why not make them enter the data in sequential order? Like:

    <form id="myForm"><input name="myField1" onBlur="blurHandler();" value="" /><br /><input name="myField2" onBlur="blurHandler();" value="" /><br /><input name="myField3" onBlur="blurHandler();" value="" /><br /></form><script type='text/javascript'>	function blurHandler(){  with(document.getElementById('myForm')){ 	 if(myField1.value==""){    myField1.focus();    return; 	 } 	 if(myField2.value==""){    myField2.focus();    return; 	 } 	 if(myField3.value==""){    myField3.focus();    return; 	 }  }	}</script>

    You could also add "Field 2 has not been completed. Would you like to edit it now?" style error messages in so users know what's happening.

  9. I wrote my own little version as I thought that website one was a little long, and hadn't done one before. Let me know what you think:

    <script type='text/javascript'>/*Date ParserCreated for W3Schools by Blue*/var iDate = "31/01/1962";function check_day_month(mon,year){	var myRegMon = new RegExp("(04||06||09||11)");		if(myRegMon.exec( mon ) && RegExp.$1 != ""){  return '30';	} else if(mon == '02'){  return check_feb(year);	} else {  return '31';	}}function check_feb(yr){	if( (yr / 4) == Math.floor(yr / 4) ){  return '29';	} else {  return '28';	}}function check_date(theDate){	var myRegEx = new RegExp(/\d{2}\/\d{2}\/\d{4}/);		if(theDate.length != 10 || myRegEx.test(theDate) == false){  return 'The field must be in the correct format';	}	var iSplit = theDate.split(/\//g);	iSplit[2] = Math.floor(iSplit[2]);	if( Math.floor(iSplit[0]) > check_day_month( iSplit[1] , iSplit[2] ) ){  return 'The number of days set was not correct for the month/year';  	}		return 'The date was parsed successfully';}var myResult = check_date(iDate);document.write(myResult);</script>

    :)

×
×
  • Create New...