-1

I am making an English to hindi transliteration webpage that works offline. I have used HTML & javascript so the file works on all browsers across all OS.

I have added support for remembering words used via a cookie provided the user works on same computer, same browser every time.

As the user types word , buttons are dynamically created which suggest on basis of database stored in cookie. Is there a way I can associate action on right clicking a dynamically created button ?

Also , I want that - the dynamically created button should vanish on right clicking it ? I want this because , if user wants to remove an erroneous entry from his vocab database (which is in a cookie referred above).

Currently I am able to remove all dynamic buttons in one go using

id-of-span-which-holds-dynamic-buttons.innerHTML = '';

A lengthier way would be to remove all buttons , then pop out word from database & recreate suggestion based on current database. Is there a simpler way ?

Where can I post my web page code (>51KB) if somebody wants to see what I have been talking about?

sao
  • 1,835
  • 6
  • 21
  • 40
user1371666
  • 445
  • 1
  • 5
  • 18
  • 2
    In order to make use of paragraphs on stackoverflow leave one blank line. In order to move the cursor to the next line use this keyboard button: http://en.wikipedia.org/wiki/File:Enter.png – oxygen Nov 14 '12 at 12:52
  • @Tiberiu-IonuțStan - awesome – Barrie Reader Nov 14 '12 at 12:55

1 Answers1

1

I have added support for remembering words used via a cookie

This is a really bad idea. It incurs a big overhead in every HTTP request - and eventually it will get to apoint where the requests get too large foer the server to cope with - then bad things can start happenning. HTML5 has proper support for local storage. Use it.

Is there a way I can associate action on right clicking a dynamically created button

Have a look around the web - do you see anything similar implemented anywhere? I never have. Trying to take over the right mouse button is a bad idea.

symcbean
  • 47,736
  • 6
  • 59
  • 94
  • as told before , the web page does not need any network to function so cookie is stored on local computer & processed there itself , never sent to any external device. – user1371666 Nov 15 '12 at 01:23
  • Okay , it seems that one cannot associate any right click action to a button . Can you tell me a method to remove dynamically created single child element ? – user1371666 Nov 15 '12 at 01:25
  • infanticide , suicide sounds humour+wise . Also , 'root has no parent' is a great observation. I cannot understand element = document.getElementById("element-id"); element.parentNode.removeChild(element); Can you tell me a way in which I can dynamically create a button which deleted itself on being pressed ? – user1371666 Nov 15 '12 at 13:21
  • hi guys , can you suggest me an html element which i can create dynamically . It should have atleast 2 parts - one will so append text to user-text-box while clicking on other should delete the element itself from webpage ? Please suggest. – user1371666 Nov 25 '12 at 12:12