Jump to content

RichardRotterdam

Members
  • Posts

    1,509
  • Joined

  • Last visited

Everything posted by RichardRotterdam

  1. with the javascript DOM functions //this will change the html inside a element with the id myElement example(<div id="myElemen"></div>) document.getElementById('myElement').innerHTML; //this will change the value inside am input with the id myElement example(<div id="myElemen"></div>) document.getElementById('myElement').value;
  2. that could work if your funtion sendRequest does the right actions <script> function createRequestObject() { var req; if(window.XMLHttpRequest){ // Firefox, Safari, Opera... req = new XMLHttpRequest(); } else if(window.ActiveXObject) { // Internet Explorer 5+ req = new ActiveXObject("Microsoft.XMLHTTP"); } else { // There is an error creating the object, // just as an old browser is being used. alert('Problem creating the XMLHttpRequest object'); } return req; } // Make the XMLHttpRequest object var http = createRequestObject(); var elementId; //id of the div to update //show suggest sentences function sendRequest(url,id) { elementId=id; // Open PHP script for requests http.open('get', url); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4 && http.status == 200){ // Text returned FROM the PHP script var response = http.responseText; if(response) { // UPDATE ajaxTest content document.getElementById(id).innerHTML = response; } } } </script> that part about the anchor i don't understand. with the anchor you could call the function as followed <a href="javascript:sendRequest('http://yoursite.com','elementId')">call ajax function</a>
  3. Only thing you need to do is first execute an insert query on your ajaxpage and then do a select querry when its done that echo's the desired new content to show. main page external ajax page -ajax call to external page -refresh content onready state -INSERT INTO query -SELECT FROM query
  4. Sounds interesting have you tried making the bag.php file generate script to pass on? for example bag.php <script> jsArray=new Array(); <?php $phpArray[0]="zero"; $phpArray[1]="one"; $phpArray[2]="two"; $phpArray[3]="three"; for($i=0;$i<sizeof($phpArray);$i++) { echo("jsArray[".$i."]=".$phpArray[$i]); } ?> <script>
  5. if your using your page for commercial goals i seriously recommends you don't pass the price to another page using a hidden input or normal input since anyone can just alter the price by saving the page to their drive and post different value's. I know for sure that i could do every activity for free then. But anyway to your problem. to show the price in a div when you selected a activity from the selectbox without refreshing the page you can use the following code. It's just a little something that gets you on your way. You will need to follow an ajax tutorial to complete the code which there are plenty of online even on phpfreaks.com. Read the comments how it works it should be a good start <script> function getPrice(activityValue){ //in this function you will have to do a call to an external AKA ajax that gets the price //alert(activityValue); //this is how to set the html inside the price_div document.getElementById('price_div').innerHTML=activityValue; } </script> <br /> <select onchange="getPrice(this.value)"> <option value="1">activity 1</option> <option value="2">activity 2</option> <option value="3">activity 3</option> </select> <br /> <b>function will place the value inside the following div</b> <div style="heigth:20px;width:100px;border-width:1px;border-color:#000000;border-style:solid;" id="price_div"> </div>
  6. Thats a piece of cake since your php runs server side and doesn't show any php code. this is what your source will look like in your php page and what you will have to write your php page <?php $price1 = "150.00" ; ?> <script> var price=<?php echo($price1);?>; </script> Now when you check the page source in you browser it will show browser source var price=150.00; easy huh
  7. if request.responseText.toString() truly has a string value like "1|0|40|titlehere" then you are splitting the the string correctly are you sure the request.responseText is has that value try to alert it
  8. Do you mean you want this price to be in a hidden input? Or do you wish to show the costumer the price of an activity? If you just want to show it you shouldn't use an input tag for security reasons
  9. It came to my mind that i kinda need that effect for my own site so I started to have a go my self on it. Unfortunately some things i haven't been able to fix. 1) It doesn't work in IE 2) The dialogBox won't center 3) I want the dialog box to not have a opacity the link to my code is http://rsh1981.phpnet.us/test/ it uses mootools and the code needed is as follow html: <style> .translucent { /*filter:alpha(opacity=50); -moz-opacity:0.5; opacity:0.5;*/ } /*ExampleFx.start(0, 1);*/ #dialogBox{ position:absolute; margin-left:auto; margin-right:auto; background-color:#000000; color:#FFFFFF; height:150px; width:300px; border-style:solid; border-width:medium; border-bottom-color:#999999; } </style> <button onclick="openPopup();">fade bg</button> <div id="blockUI" class="translucent"style="opacity:0;display: none; background-color: gray; width: 100%; height: 100%; position: absolute; left: 0px; top: 0px; z-index: 50000;" onclick="return false" onmousedown="return false" onmousemove="return false" onmouseup="return false" ondblclick="return false"> <div id="dialogBox"><b>Dialog Box</b></div> </div> javascript function openPopup(){ var ExampleFx = new Fx.Style('blockUI', 'opacity', { //the fact i apply the effect on el wait: false, //and wait: false which make the effect not waiting (very useful on the mouseout or mouseleave function... duration: 1000, transition: Fx.Transitions.linear }); $('blockUI').setStyle('display','inherit'); ExampleFx.start(0,0.7) }
  10. yeah that thing is kinda cool I tried to get that js popup running on my localhost but without luck. Basicly its a div popup with some kinda transperancy. I found out that it uses the function movie_viewer.Launch() to open a popup. The url for that file is http://js.ngfiles.com/movieviewer.js maybe someone can solve this how to use that script
  11. I remembered answering a similar question check this link out it might help http://www.phpfreaks.com/forums/index.php/topic,147397.0.html I think that won't work btw since your iframe will contain the text editor
  12. you can't restrict them from entering html tags but you can filter the html out when you submit a form. Using javascript might seem like a solution to prevent a person from entering html into a textarea but you can always disable javascript
  13. this is how you pass a php variable to javascript. <script> var myJSvar="<php? echo($phpVar);?>"; </script> now you have a javascript variable that you can pass to the iframe there are loads of examples how to pass a js var from one frame to another try and google it up
  14. What you will need to do is pass the php variables to javascript from javascript you can pass it to the iframe
  15. You can't paste that into the textarea your trying to execute php clientside which is impossible
  16. you could build an array with html strings in it var myHelp myHelp=new Array(); myHelp[1]="your help1"; myHelp[2]="your help2"; then just random select an array
  17. Still sorry to say but blocking opera is just idiotic it won't help your website being more secure If you want to make the world better block IE instead
  18. Right and I am so sure that opera allows you to edit the source on a remote webpage server. I doubt it. But anyway if you are so sure you can always detect a user agent but these can be faked. But seriously I wouldn't bother doing it who ever said opera is a security risk doesn't know a crap about how webpages work
  19. You can use my class if you like but it does require mootoolshttp://mootools.net/download be sure to have <b>Native->functions</b> selected when you download it once you downloaded it include it into your HTML then paste my js into your head section <script language="JavaScript"> //Timer class function Timer(){ //object variables this.startTime; this.passedTime; this.currenTime; /*--Object functions--*/ //starts the timer this.startTimer=function(){ this.startTime=new Date(); this.passedTime=new Date(); //needs delegate thats why the this value is passed this function is called every second this.increaseTime.periodical(1000,this); }; //increases the time this.increaseTime=function(){ //each time the function is called the current time will be checked this.currenTime=new Date(); //calculates the time that has passed this.passedTime.setTime(this.currenTime.getTime()-this.startTime.getTime()); //$('time').value=this.passedTime.getMinutes()+":"+this.passedTime.getSeconds(); }; //returns the time in a string this.getPassedTime=function(){ //extra variables to show a neat time to return var seconds; var minutes; var hours; //nice display of seconds into a string if(this.passedTime.getSeconds()<10) { seconds="0"+String(this.passedTime.getSeconds()); }else{ seconds=String(this.passedTime.getSeconds()); } //nice display of minutes into a string if(this.passedTime.getMinutes()<10) { minutes="0"+String(this.passedTime.getMinutes()); }else{ minutes=String(this.passedTime.getMinutes()); } //returns the minutes:seconds in a string return minutes+":"+seconds; } } </script> then when you start your function do the following function yourFunction(){ //create a Timer Object var timer=new Timer(); timer.startTimer();//starts the timer } and when the function is done just call the function timer.getPassedTime() //alert the time that has passed when the function started alert(timer.getPassedTime());
  20. this might help you http://www.javascript-page.com/timer.html
  21. here you go buddy no need to set the height I just use the clear break check out the css and <br class="clear" /> to see what i mean <html> <head> <style type="text/css"> body,html { } #main_content { width:800px; background:url(images/bgimage.gif) repeat-y; margin:auto; } #left_column { width:200px; float:left; } #right_column { width:600px; float:right; } br.clear{ clear:both; } </style> </head> <body> <div id="main_content"> <div id="left_column"></div> <div id="right_column">Lorem Ipsum</div> <br class="clear" /> </div> </body> </html>
  22. What image does not display logo.gif? and in what frame? you might need to send more source code or better yet don't use frames these are just horrible
  23. That only works for IE though It's called a tooltip the javascript tooltips do looker cooler but you can achieve it by using css only
  24. I know its possible in flash but why not just use images instead?
  25. Roll over what 0.o i don't see anything special happening with the menus
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.