Jump to content

jesh

Members
  • Posts

    2,293
  • Joined

  • Last visited

Everything posted by jesh

  1. In your first post you were referring to the file as "photo.html" but now you are referring to it as "photo.htm". Perhaps the file on the server has the .html extension rather than the .htm extension?
  2. Yeah, we utilize something like that where I work. Perhaps you could use this idea (have a function that handles the onchange event) and have the function add the ID of the element that has changed into an array.Then, when the submit button is pressed, you can check the array to see if there are any IDs in it, if so, you can warn the user which form elements had changed.Good luck!
  3. Internet Explorer has a funky security setting which disallows most scripting by default when you load up a file from your computer's file system. As far as I am aware, you will always get that confirmation message. The message won't appear when the file is loaded from a web server (even localhost).If anyone knows how to disable this "feature", I'd be happy to know it.
  4. If you are developing for DOM compliant browsers, you can use the XML DOM to generate XHTML. <div id="parent"></div><script type="text/javascript">var div = document.createElement("div");div.innerHTML = "Hello!";document.getElementById("parent").appendChild(div);</script>
  5. jesh

    Concatenate commands

    It has been a long time since I worked regularly with VBScript, but don't you have to use the DOM to get at an element in the HTML?If you ran checkbox = "chk" & sControlName & ".state" checkbox should just contain a string ("chkSM2.state" for example);In javascript, you'd have to use something like this: var checkbox = document.getElementById("chk" + sControlName);var state = checkbox.state; EDIT: If you can access the state of a checkbox by using chkSM1.state, then you might try something like this: checkbox = "chk" & sControlNamestate = checkbox.state
  6. Does the page render correctly when you type in the URL into your address bar rather than accessing it using AJAX? Try visiting "getPass?id=someid", if it still shows the PHP code, then you don't seem to have your server configured correctly to handle PHP without the .php extension.
  7. Why not run the test on the textarea itself since that is what is likely to change? <textarea id="mytext">Default Text</textarea><script type="text/javascript">var defaultText = document.getElementById("mytext").innerHTML;function func_btn_click(){ var newText = document.getElementById("mytext").innerHTML; alert(defaultText == newText);}</script>
  8. I found this post. It might help. http://www.dynamicdrive.com/forums/archive...php/t-6966.htmlThe gist of the code is as follows: <html><head><script type="text/javascript">function hanldeScroll(e){ e = (e) ? e : window.event; var delta = (e.wheelDelta) ? e.wheelDelta : e.detail; alert(delta);}if(document.attachEvent) document.attachEvent("onmousewheel", hanldeScroll);else window.addEventListener("DOMMouseScroll", hanldeScroll, false);</script></head><body>...</body></html> When I ran a test in the Tryit Editor, IE would alert 120 when I scrolled one direction and -120 when I'd scroll in the other direction. Firefox would alert 3 and -3.
  9. Ah, if you are looking for the element which caused the event, you can do this - you have to use target to get the element using DOM and srcElement to get the element using IE: function handleEvent(e){ e = (e) ? e : window.event; var element = (e.target) ? e.target : e.srcElement; alert(element.id);}
  10. The way I handled this was to use a private variable (without the this keyword) to store my httpRequest object inside my AJAX object and I used an internal function to handle the readystatechange event (to which I could pass a reference to a separate function to handle the response): function sendData(smethod,surl,sdata,basync,index,callback){ this.GetXmlHttpObject=GetXmlHttpObject; this.index=index; var xmlHttp=this.GetXmlHttpObject() ... xmlHttp.onreadystatechange=function(){ HandleAjaxRequest(callback); } function HandleAjaxRequest(callback) { if(xmlHttp.readyState == 4) { callback(xmlHttp); } } ...} Then, you could use it like this: function myCallbackHandler(response){ alert(response.responseText);}var test = new sendData('POST','pagea.php','id=1',true,0,myCallbackHandler); Hope it helps!
  11. You might try something like this: <style type="text/css">table { border-style: solid; border-color: #006699; border-width: 0px 1px 1px 0px; }td { border-style: solid; border-color: #006699; border-width: 1px 0px 0px 1px; }</style><table cellpadding="0" cellspacing="0" border="0"> <tr><td>1</td><td>2</td><td>3</td></tr> <tr><td>1</td><td>2</td><td>3</td></tr> <tr><td>1</td><td>2</td><td>3</td></tr></table> That puts a border on the top and left side of each table cell and a border on the right and bottom of the table itself.
  12. It's done with CSS, javascript, and HTML DOM. Something like this: <html><head><style type="text/css">input.Required { background-color: #cc0000; }input.Selected { background-color: #ffffff; }</style></head><body><input type="text" class="Required" onfocus="this.className='Selected';" onblur="this.className='Required';" /><input type="text" class="Required" onfocus="this.className='Selected';" onblur="this.className='Required';" /><input type="text" class="Required" onfocus="this.className='Selected';" onblur="this.className='Required';" /></body></html> Check out these links for more info:http://www.w3schools.com/htmldom/dom_obj_event.asphttp://www.w3schools.com/htmldom/prop_body_classname.asp
  13. The HTML-only version will take you to the top of the page if you don't specify an anchor with a matching name. For example (using pulpfiction's example):<body><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><a href="#top"><img src="imgname.gif"></a></body> Clicking on that image in the bottom will take you to the very top of the page even though there is no anchor specified with a name "top". According to W3Schools (http://www.w3schools.com/html/html_links.asp), Whatever way works best for you.
  14. I played around with your code in the Tryit Editor and noticed, in Firefox, that I couldn't select any of the radio buttons. Turns out it was because of the positioning you used. I added the following to the CSS and it allowed me to select the radio buttons: #checkbox input { position: relative; z-index: 2; } I hope it helps.EDIT: If you want to be able to click on text to select the radio button, you might want to look into using labels (http://www.w3schools.com/tags/tag_label.asp). Here's an example: <label for="baby">baby</label><input type="radio" name="crime" id="baby" value="steal from baby">Steel van een baby<br>
  15. jesh

    Show/Hide text

    <script type="text/javascript">function toggle(id){ var obj = document.getElementById(id); if(obj.style.display == "block") { obj.style.display = "none"; } else { obj.style.display = "block"; } // return false here so that the link doesn't try to send // the visitor to whatever is in the href of the link when // s/he clicks on it. return false;}</script><a href="#" id="showResult" onclick="toggle('result');">Vis resultater >></a><div id="result" style="display: none"><p>Testing</p></div <!-- #result -->
  16. I believe MrAdam means:<script>function mouseXY(e){// so that it'll work in DOM compliant browsers as well as IEe = (e) ? e : window.event; var X = e.clientX;var Y = e.clientY;document.getElementById("movingDiv").style.top=X;document.getElementById("movingDiv").style.left=Y;}window.onload=mouseXY;</script></head><body onmousemove="mouseXY(event);">
  17. The document.getElementById(id) function gets an element out of the DOM by the ID of the element.This code would work: <div id="mydiv"></div><script type="text/javascript">document.getElementById("mydiv").innerHTML = "Hello!";</script> If you are recieving an Object not found error, then the getElementById function is unable to find an element in the DOM with the id that you are passing it. One common reason for this happening is that the function is being called before the element has been added to the DOM by the browser.This code will give you an Object not found error. <script type="text/javascript">document.getElementById("mydiv").innerHTML = "Hello!";</script><div id="mydiv"></div> You might check to make sure that the element is being added to the DOM before the function is being called.
  18. jesh

    css,xml

    If you want to learn on your own (i.e. from a website), I would suggest starting with javascript. There is an excellent tutorial here:http://www.w3schools.com/js/default.aspOnce you learn javascript, you'll begin to have an idea of how programming languages work and can then move on to PHP, C#, VB, etc.If, on the other hand, you want someone to teach you (i.e. in a school), go for either PHP or ASP.NET (C#).My two cents.
  19. jesh

    Removing 0's

    Check out number_format() (@ http://www.php.net/number_format)
  20. jesh

    Tables in IE and Mozilla

    Does changing: <td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FF0000" id="tbl_1" style='{display : none}' > To: <td width="100%"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FF0000" id="tbl_1" style='{display : none}' > help at all?
  21. jesh

    Style Sheets

    You might look into using document.styleSheets to get at the style sheet data, but I've no experience with it and don't know if you can set the properties or if they are read-only.Here's a link to get you started:http://www.pxl8.com/styleSheet_object.html============================If it were me, I would probably set up multiple css classes - one for one font-size, another for a bigger font-size - and then change the className of the element: document.getElementById("myElement").className = "Bigger"; Or, like in the link that pulpfiction provided, I would access the style property of the element and increse the font-size with the DOM: document.getElementById("myElement").style.fontSize = "32px"; Or, if I needed to do this for all paragraph elements, for example, I'd do something like this: var ps = document.getElementsByTagName("p");for(var i = 0; i < ps.length; i++){ ps[i].style.fontSize = "32px"; // OR: // ps[i].className = "Bigger";} EDIT: Here's another link for accessing the stylesheet through the DOM:http://www.javascriptkit.com/domref/stylesheet.shtml
  22. jesh

    Wrapper

    I viewed your code in the TryIt editor in both IE6 and Firefox and I wasn't able to see any problems with text extending out of the divs. It looked fine to me.However, typically, when you use float, you'll have to throw in a clear after the floated content to make the containing element expand in size to fit the content.
  23. It's a combination of CSS, HTML DOM, and javascript.HTML <button onclick="showMore('moreDetail');">More...</button><div id="MoreDetail"> This is more detail that is initially invisible but it's shown when user clicks the button.</div> CSS: #MoreDetail { display: none; } Javascript + HTML DOM function showMore(elementID){ document.getElementById(elementID).style.display = "block";} Here are some links:http://www.w3schools.com/css/pr_class_display.asphttp://www.w3schools.com/htmldom/prop_style_display.asphttp://www.w3schools.com/htmldom/event_onclick.asp
  24. You're going to need server-side code to accomplish this. I'm going to assume that you are using Java (i.e. jsp, jhtml, etc.), although you can use any server-side code: PHP, CF, ASP.NET, ASP, etc.One place to start is to build the form and submit it, and its data, to another page. Then, on the server, get the data from the HTTP Request. In .NET, it'd look something like: string first_name = Request["FirstName"].ToString(); In PHP, something like: $fname = $_GET["FirstName"]; Each language will be a little different.Once you are able to get the data, you'll need to look into storing that data across many different pages so that a visitor who is on one page and puts an item in the cart still has those items in his/her cart when s/he visits another page. Most developers would use Sessions for this. Look into how to use Sessions in the language that you use.Alternatively, I'm sure you can find a pre-built solution available that you can purchase for a nominal fee which you can plug into your site so that you don't have to do so much development.I hope this helps!
  25. Postback and ViewState were two things that made me think a bit differently. You might start there.
×
×
  • Create New...