Jump to content

Ang3l0fDeath

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Ang3l0fDeath's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. For those who want to do the loading of External files http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml function loadjscssfile(filename, filetype){ if (filetype=="js"){ //if filename is a external JavaScript file var fileref=document.createElement('script') fileref.setAttribute("type","text/javascript") fileref.setAttribute("src", filename) } else if (filetype=="css"){ //if filename is an external CSS file var fileref=document.createElement("link") fileref.setAttribute("rel", "stylesheet") fileref.setAttribute("type", "text/css") fileref.setAttribute("href", filename) } if (typeof fileref!="undefined") document.getElementsByTagName("head")[0].appendChild(fileref) } loadjscssfile("myscript.js", "js") //dynamically load and add this .js file loadjscssfile("javascript.php", "js") //dynamically load "javascript.php" as a JavaScript file loadjscssfile("mystyle.css", "css") ////dynamically load and add this .css file
  2. #5 was the winner. Simple and easy. Got loading of external files done. However i ran into a Browser cache problem, external files data wasnt up to date and i really got tired of my own alert('test message') showing up even though i deleted it from the external file. I could give #4 a try. But in the long run it would be saving bandwidth with #3 or #5 with also a more secure site.
  3. I've worked on 3 different AJAX run chats, offline and online. Only time i've experienced the browser freezing up was when javascript/AJAX was the cause. If you got page Timers. Test if its the cause by changing the interval between execution. I've only had a timer set to 1 second repeat and my PC usage was at 100% the whole time, and with the chat going and the more messages appeared on the chat, the more laggy my PC got. If you got a function that process alot of data repeatively, related to the timer thingy again, space it out or remove this function tempary to test if the function could be the problem. Also i dont think its your PC / Server / PHP / MYSQL thats the problem. It is also possibly smart to test your AJAX scripts. I suggest you post that information up here and see if anyone notice a problem with AJAX script that could be slightly related to your problem.
  4. Im looking for an example script. I dont need exactly 5 minutes at all, in fact its link to a button. The Example script im looking for will be on a simple loading a javascript file onto the current page where the function are use-able after the file has loaded. I've read 3 different ways, but each sounds like it has own issues. I've also read and thought of using a 4th way on my site. way 1 - AJAX load a page with both the javascript and html content on the page. way 2 - AJAX load just the javascript file into a DIV container way 3 - AJAX load a javascript file and document.create ('script') element and place the file within side the script element. way 4 - iframe/frame to a page that has javascript and html content present, however the javascript within the frame will either work with inside its own frame/page or set it to make changes on the parent page. way 5 - simply just add all the javascript files to my main page. I know some people only done this 1 way, and i was wondering which are the worst approach and which might be the most flexible / reliable. So far i think im going to try way # 4. However when the site is complete i think way # 5 will do fine, thats how a AJAX site is suppose to be. And if anyone curious about the layout of my site. files listed below www.domain.com/index.php - only page anyone will ever look at. www.domain.com/.htaccess - deny access to all dictionarys & files except www.domain.com/ www.domain.com/p=.php - this is the file my AJAX request will be made to, this file will do my GET / POST request and process of all information. This p=.php file will fetch all information from my sub-dictionarys which could be 1 file or hundreds of files.
  5. var input_tag=document.getElementsByTagName("input"); for (i=0; i<input_tag.length; i++){ if(input_tag.type==='checkbox'){input_tag.checked=true;} } // Sorry i couldnt really go though your script and fix it. But i gave you a simple select all checkboxes option above.
  6. Well good job catching up, hope you get around to understanding this stuff. I didnt learn javascript until after i learned PHP. Now everything seems like a second language to me except asp & cgi. 310 lol, your the first to say something like that. Also a small suggestion for your page. Set a background & color in the <body> Plus you can style up the page a bit more with css or <style> Only thing i would really suggest to throw in there CSS wise is padding-right:5; or paddingLeft=5; depending on if your using inline style or not.
  7. You need to give more detail on what you want to do.... yes i know you want to change a link, but how? and do you want to change the link location or the text of the link? And can you give examples of the links you want to change? Also here is a few examples of stuff to look into or change about you function function a_href_update( id, field_name ) { document.getElementById(field_name).value = id; //here i want change the value document.getElementById(field_name).href = new_url; //a href change url location document.getElementById(field_name).value= new_text; //input element value change document.getElementById(field_name).innerHTML= new_text; //a link element change text // I find it confusing you have field_name & id, thats 2 location pointers and you only need 1. // you only need 1 location pointer which generally ID= or Name= or ClassName= // If you do the Name=/ClassName= you still got to go another step to identify location. ID is generally best for a unique ID name. // If you changing lots of links at once do yourself a favor and run it though a loop }
  8. Can i ask what was the name of the class your taking / major your in?
  9. Ya plus i had an extra thought for ya.... like add a start and stop function to your mouse cursor. Cause you can add in the extra feature of adding / changing images. Example. Like you click a button on your page, the mouse cursor would have like an explodion or fireworks, or it simply changes colors from gray to lime green. Well good luck with your site lol
  10. OMG its you again with the name. your really not a javascript person. Anyways im sure this post is old, idk if you still want help or not. But my question to you is. How many shirt Options you got? 1-10? How many shirt Sizes you got? 1-6? Does all your shirts come in all sizes or do some shirts only come in large while others come in all sizes? How many other options of shirt selection are there? Cause really you can make a nice javascript to handle all your data, and your selections. Plus if you got pictures of your shirts, you could also add that into a javascript to display the different shirts each time you change the shirt selection and size as well. Cause simply you and increase an image size or decrease it. Also why are you having problems with the database / page? what is cause the problems? Is it like people selecting multi-checkboxs and you only want them to select one? huh?
  11. elementObject.style //This is how you tell an elementObject its going to be styled in CSS elementObject.style.color='white';// OR ='#ffffff'; elementObject.style.backgroundColor='red';// OR ='#800000'; elementObject.style.padding=5; elementObject.style.textAlign='center'; hopefully thats enough examples for you to understand it.
  12. Nice username. However im confused on what your trying to say. wraping text is easy. http://www.w3schools.com/css/pr_text_white-space.asp If your trying to count the length of your input try. http://www.w3schools.com/jsref/jsref_length_string.asp
  13. You'll have to forgive me not giving you an exact working example. Im giving you the framework you need. I could give you a better code and more helpful code if i have some additional information. where is the timer on your page? and big is the timer section like 20x20? 40x40? 60x60? 80x80? Also i suggest you put a clock with the timer, its very helpful in allowing a person to know the time and when they should be done. Also what type of exam is this and whats it for? Javascript is helpful with user-friendly functions, but there could be a security problem if you relay 100% on javascript to handle the whole timing of the exam. Reason why i say javascript could have a security issue is cause anything and everything javascript could be hacked since its on the client user end. // create a function to start your timer. // page onload event works best // button onclick works well too. var mins_limit = 45;//personally i use seconds cause its more accurate var limit_seconds = mins_limit*60;//see i made a seconds thingy. var start_time = 0;//This varible is the start of the 45 minutes. function start_timer(){ // i stopped my work here cause idk what you got to work with. Setting a timer is easy, but you still got to output the varibles into elements/fields which with a simple timer you only need 1 output area, but if you want something a bit more like i said above it could take 4-6 id fields and a bit more functions / math / work. }
  14. I have a webpage that has tons of data as well.... best way i found to edit data or save data is to do it though javascript. Javascript greatly reduced the code on the page, the reason why is the only function i had was <tr><td><input type=button value='Save' onclick="save_data(this);"> I hope you know what ( this ) is, is so read up on it. This will result in an elementObject of the input field. But use your nodes. elementObject.parentNode.parentNode. alert the results of the elementObject that results for each part and stop at the HTML - TR node. After that you can evaluate data each INPUT field or TD field within the TR element. If your understanding why im suggesting this you might find it useful in processing your data back into a AJAX thingy. Personally i would loop each input field into a query string and send that string back to a page that is just meant to recieve data. However you can use the CURRENT page to recieve the data. HOW? Well in PHP you divid your page. 1 page would be recieving POST/GET request. Another would be the output of the normal page which is ur current page. From what i see your good enough with ajax/css/probably php and a few other languages to figure out what solution you need and how to make it work. I hope something here helped.
  15. <a href="javascript:addEducation('?id=3');"> function addEducation(url_query){ alert(url_query);// to test //window.location.href=url_query; // this will forward the page to your url }
×
×
  • 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.