FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Adding dhtml and ajax features... plz help !

 


salman_500
hey !

well im making a one file dhtml website and i need some help.
Im done with the page switching thing.

Now i want a page that only people i want to enter, can enter. As im not using databases, I want it so that when the page is opened, the visitor is required to enter a code that i et to decide. And only if he can, does the page open. now i've seen such applications, but i was able to bypass them by looking in the page source for the code... and i dont want this to heppen in this case... make the code encrypted or something...

one more thing that i want is that in-page editing... I cudnt find the rite thing for me on the web.. so ill try my luck here.. you see i want it soo that im the only one allowed to edit the page.. and as im not making any user management system, i want it so that there is a link someplace, when that links is clicked, another password textfield comes up, where i get to enter a password in order to edit the details of the page... but what i want is that the data is saved within the file and not a database.. like inside the html code...

If someone can do this for me, ill give him 100 frih$s or more idc... just do it for me !

Thanks !
sonam
I am not sure am I understand you, and can I help you, but here is one JS what I find few mont ago somewhere on the Internet. I didn't try it because I am prefer php, and DB but it is working like CMS. Maybe you can customize this script for your needs.

Sonam

Code:
<script type="text/javascript">
<!--

var editing  = false;

if (document.getElementById && document.createElement) {
   var butt = document.createElement('BUTTON');
   var buttext = document.createTextNode('Ready!');
   butt.appendChild(buttext);
   butt.onclick = saveEdit;
}

function catchIt(e) {
   if (editing) return;
   if (!document.getElementById || !document.createElement) return;
   if (!e) var obj = window.event.srcElement;
   else var obj = e.target;
   while (obj.nodeType != 1) {
      obj = obj.parentNode;
   }
   if (obj.tagName == 'TEXTAREA' || obj.tagName == 'A') return;
   while (obj.nodeName != 'P' && obj.nodeName != 'HTML') {
      obj = obj.parentNode;
   }
   if (obj.nodeName == 'HTML') return;
   var x = obj.innerHTML;
   var y = document.createElement('TEXTAREA');
//   y.appendChild(document.createTextNode(x));
   var z = obj.parentNode;
   z.insertBefore(y,obj);
   z.insertBefore(butt,obj);
   z.removeChild(obj);
   y.value = x;
   y.focus();
   editing = true;
   return false;
}

function saveEdit() {
   var area = document.getElementsByTagName('TEXTAREA')[0];
   var y = document.createElement('P');
   var z = area.parentNode;
   y.innerHTML = area.value;
   z.insertBefore(y,area);
   z.removeChild(area);
   z.removeChild(document.getElementsByTagName('button')[0]);
   editing = false;
   return false;
}


document.onclick = catchIt;

// -->
</script>
salman_500
thx !

can u plz explain to me how the script works ? im a beginner to javascripts... a part by part explanation would be really appreciated !

Thanks !
sonam
He, he, I am also beginner to javascripts... but if I am good remeber this script open text areas where you can simple edit your html.

Sonam
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.